 /**
 * Convert base64 string to Uint8Array
 * @param {string} base64String - The base64 string to convert
 * @returns {Uint8Array} - The converted Uint8Array
 */
export const fromBase64String = (base64String) => {
    if (!base64String) {
      return new Uint8Array()
    }
    
    try {
      // Remove data URL prefix if present
      const base64Data = base64String.replace(/^data:.*?;base64,/, '')
      
      // Convert base64 to binary string
      const binaryString = atob(base64Data)
      
      // Convert binary string to Uint8Array
      const bytes = new Uint8Array(binaryString.length)
      for (let i = 0; i < binaryString.length; i++) {
        bytes[i] = binaryString.charCodeAt(i)
      }
      
      return bytes
    } catch (error) {
      console.warn('Failed to convert base64 string:', error)
      return new Uint8Array()
    }
  }